<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        {
            let age = 18; // 块级作用域--适用于临时变量
            var name = 'Tom'
        }
        // console.log(age);
        console.log(name);

        for(let i=0; i<5; i++){
            console.log(i);
        }
        // console.log('out:', i);// i is not defined--出了for循环的作用域，i就没有定义了
    </script>
</body>
</html>